/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

using ll = long long;

constexpr int maxn = 1e5 + 2, mod = 1e9 + 7;

int f[maxn][2];

std::vector<int> e[maxn];

void dfs(int u) {
  if (e[u].empty()) {
    f[u][0] = f[u][1] = 1;
    return;
  }
  std::vector<int> pre(e[u].size()), suf(e[u].size());
  for (auto v : e[u]) dfs(v);
  pre[0] = 1;
  for (size_t i = 0; i < e[u].size() - 1; ++i) {
    pre[i + 1] = (ll)f[e[u][i]][0] * pre[i] % mod;
  }
  suf[e[u].size() - 1] = 1;
  for (size_t i = e[u].size() - 1; i > 0; --i) {
    suf[i - 1] = (ll)f[e[u][i]][0] * suf[i] % mod;
  }
  f[u][0] = (ll)pre[e[u].size() - 1] * f[*e[u].rbegin()][0] % mod;
  for (size_t i = 0; i < e[u].size(); ++i) {
    int v = e[u][i];
    f[u][1] += (ll)pre[i] * suf[i] % mod * f[v][1] % mod;
    if (f[u][1] >= mod) f[u][1] -= mod;
  }
  f[u][0] += f[u][1];
  if (f[u][0] >= mod) f[u][0] -= mod;
}

int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int tmp;
    cin >> tmp;
    e[tmp].push_back(i);
  }
  dfs(1);
  cout << f[1][0] << '\n';
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("E. Interactivity.in", "r", stdin);
  freopen("E. Interactivity.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
